#include <bits/stdc++.h>
#ifndef DEBUG
#define debug
#endif
using namespace std;
using i64 = int64_t;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> diff(n + 2, vector<int>(n + 2));
  while (m --) {
    int l1, r1, l2, r2;
    cin >> l1 >> r1 >> l2 >> r2;
    diff[l1][r1] ++;
    diff[l2 + 1][r2 + 1] ++;
    diff[l1][r2 + 1] --;
    diff[l2 + 1][r1] --;
  }
  vector<vector<int>> a(n + 1, vector<int>(n + 1));
  for (int i = 1; i <= n; i ++) {
    for (int j = 1; j <= n; j ++) {
      a[i][j] = a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1] + diff[i][j];
    }
  }
  for (int i = 1; i <= n; i ++) {
    for (int j = 1; j <= n; j ++) {
      cout << a[i][j] << " ";
    }
    cout << "\n";
  }
}